﻿<UserControl x:Class="BillsManager.Views.DataTemplates.BillDataTemplate"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:ViewModels="clr-namespace:BillsManager.ViewModels;assembly=BillsManager.ViewModels"
             xmlns:cal="http://www.caliburnproject.org"
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
             d:DataContext="{d:DesignInstance IsDesignTimeCreatable=True,
                                              Type={x:Type ViewModels:BillDetailsViewModel}}"
             mc:Ignorable="d">

    <UserControl.Resources>
        <!--<ResourceDictionary Source="/BillsManager.Views;component/Dictionaries/Styles.xaml" />-->
        <ResourceDictionary Source="/BillsManager.Views;component/Themes/Themes.xaml" />
    </UserControl.Resources>

    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition Height="{StaticResource View.MarginSize}" />
            <RowDefinition Height="Auto" />
            <RowDefinition Height="{StaticResource View.MarginSize}" />
            <RowDefinition Height="Auto" />
            <RowDefinition Height="{StaticResource View.MarginSize}" />
        </Grid.RowDefinitions>
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="{StaticResource View.MarginSize}" />
            <ColumnDefinition Width="Auto" SharedSizeGroup="col1" />
            <ColumnDefinition Width="42" />
            <ColumnDefinition Width="Auto" SharedSizeGroup="col3" />
            <ColumnDefinition Width="42" />
            <ColumnDefinition Width="Auto" SharedSizeGroup="col5" />
            <ColumnDefinition Width="{StaticResource View.MarginSize}" />
        </Grid.ColumnDefinitions>

        <TextBlock Grid.Row="1"
                   Grid.Column="1"
                   HorizontalAlignment="Left"
                   Text="{Binding Supplier.Name}" />

        <TextBlock Grid.Row="1"
                   Grid.Column="3"
                   HorizontalAlignment="Left"
                   Text="{Binding Code}" />

        <TextBlock Grid.Row="1"
                   Grid.Column="5"
                   Language="it-IT"
                   Text="{Binding Amount,
                                  StringFormat=\{0:c\}}" />

        <StackPanel Grid.Row="3"
                    Grid.Column="1"
                    Grid.ColumnSpan="5"
                    HorizontalAlignment="Left"
                    Orientation="Horizontal">
            <TextBlock Visibility="{Binding IsNotPaid, Converter={StaticResource BooleanToVisibilityConverter}}">
                <Run Text="{Binding DuesIn, Mode=OneWay}" />
                <Run Text=" " />
                <Run Text="{Binding DueDate, Mode=OneWay, StringFormat=(\{0:dddd dd/MM/yy\})}" />
            </TextBlock>
            <TextBlock Visibility="{Binding IsPaid, Converter={StaticResource BooleanToVisibilityConverter}}">
                <Run Text="Payed" />
                <Run Text=" " />
                <Run Text="{Binding PaymentDate, StringFormat=\{0:ddddd dd/MM/yy\}, Mode=OneWay}" />
            </TextBlock>
        </StackPanel>

        <!--
            <TextBlock Grid.Row="3"
            Grid.Column="1"
            Grid.ColumnSpan="5"
            MaxWidth="230"
            Text="{Binding Notes}"
            VerticalAlignment="Center"
            HorizontalAlignment="Left"
            TextTrimming="CharacterEllipsis" />
        -->
    </Grid>
</UserControl>